package com.base.mapper.voipmapper;

import com.base.po.sqlparam.UsersExamplePage;
import com.base.po.voip.Users;
import com.base.po.voip.UsersExample;
import com.base.utils.Page;

import java.util.List;
import org.apache.ibatis.annotations.Param;

public interface UsersMapper {
	int countByExample(UsersExample example);

	int deleteByExample(UsersExample example);

	int deleteByPrimaryKey(String id);

	int insert(Users record);

	int insertSelective(Users record);

	List<Users> selectByExample(UsersExample example);
	
	List<Users> selectByUsers(Users record);
	
	List<Users> selectByUserName(@Param("username") String username);
	
	List<String> selectByParentId(@Param("parentId") String parentId);
	
	List<Users> selectByPid(@Param("parentId") String parentId);
	
	List<String> selectParentIdByShopiId(@Param("shopid") String shopid);
	
	List<String> selectUserNameByParentId(@Param("parentId") String parentId);
	
	List<String> selectByShopId(@Param("shopId") String shopId);
	
	List<String> selectUserNameByShopId(@Param("shopId") String shopId);

	List<Users> selectByExamplePage(UsersExamplePage examplePage);
	
	List<Users> selectByAll(@Param("page") Page page, @Param("username") String username, @Param("pId") String pId,
                            @Param("sId") String sId, @Param("datastatus") Boolean datastatus);
	
	List<Users> selectByParentID(@Param("page") Page page, @Param("parentid") String parentid,
                                 @Param("username") String username, @Param("pId") String pId, @Param("sId") String sId,
                                 @Param("datastatus") Boolean datastatus);
	
	List<Users> selectByShopID(@Param("page") Page page, @Param("shopid") String shopid,
                               @Param("id") String id, @Param("pId") String pId, @Param("sId") String sId,
                               @Param("datastatus") Boolean datastatus);

	List<Users> selectByShopIDNotAll(@Param("page") Page page, @Param("shopid") String shopid,
                                     @Param("username") String username, @Param("pId") String pId, @Param("sId") String sId,
                                     @Param("datastatus") Boolean datastatus);
	
	List<Users> selectOEMByAll(@Param("page") Page page, @Param("username") String username,
                               @Param("datastatus") Boolean datastatus);
	
	List<Users> selectOEMByParentID(@Param("page") Page page,
                                    @Param("parentid") String parentid, @Param("username") String username,
                                    @Param("datastatus") Boolean datastatus);
	
	List<String> selectAllShop(String id);
	
	Users selectByPrimaryKey(String id);

	Users selectByUsername(String username);

	int updateByExampleSelective(@Param("record") Users record, @Param("example") UsersExample example);

	int updateByExample(@Param("record") Users record, @Param("example") UsersExample example);

	int updateByPrimaryKeySelective(Users record);

	int updateByPrimaryKey(Users record);
	
	int countByAll(@Param("username") String username, @Param("pId") String pId,
                   @Param("sId") String sId, @Param("datastatus") Boolean datastatus);
	
	int countByParentID(@Param("parentid") String parentid, @Param("username") String username,
                        @Param("pId") String pId, @Param("sId") String sId,
                        @Param("datastatus") Boolean datastatus);
	
	int countByShopID(@Param("shopid") String shopid,
                      @Param("id") String id, @Param("pId") String pId, @Param("sId") String sId,
                      @Param("datastatus") Boolean datastatus);
	
	int countByShopIDNotAll(@Param("shopid") String shopid,
                            @Param("username") String username, @Param("pId") String pId, @Param("sId") String sId,
                            @Param("datastatus") Boolean datastatus);
	
	int countOEMByAll(@Param("username") String username, @Param("datastatus") Boolean datastatus);
	
	int countOEMByParentID(@Param("parentid") String parentid, @Param("username") String username,
                           @Param("datastatus") Boolean datastatus);

	// 查询所有pdd client_id client_secret
	List<Users> selectByPdd();

    Users selectByshopName(@Param("selfShopName") String selfShopName);

    List<Users> selectUsersByRole(@Param("role") int role);

	Users selectsomeByPrimaryKey(@Param("id") String id);

	int hasUsers(@Param("parentId") String parentId);

    String selectAllChildByShopId(@Param("shopId") String adminUserId);

	List<String> selectForLowerLevel(@Param("shopId") String shopId);

	List<String> selectForLowerLevelByList(@Param("list") List<String> list);
}